package com.it.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.it.mapper.FinancialReportMapper;
import com.it.pojo.FinancialReport;
import com.it.service.FinancialReportService;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;

@Service
public class FinancialReportServiceImpl extends ServiceImpl<FinancialReportMapper, FinancialReport> implements FinancialReportService {

    @Override
    public Page<FinancialReport> getFinancialReports(int page, int pageSize, String search) {
        Page<FinancialReport> pageParam = new Page<>(page, pageSize);
        return (Page<FinancialReport>) baseMapper.selectReportPage(pageParam, search);
    }

    @Override
    public boolean createFinancialReport(FinancialReport report) {
        return save(report);
    }

    @Override
    public boolean updateFinancialReport(FinancialReport report) {
        return updateById(report);
    }

    @Override
    public boolean deleteFinancialReport(Integer id) {
        return removeById(id);
    }

    @Override
    public List<String> getReportTypes() {
        // 这里简单返回固定类型，实际可以从数据库或配置获取
        return Arrays.asList("日报", "周报", "月报", "季报", "年报");
    }
}